Docker Python環境構築
ファイル構造
code:tree
.
├── Dockerfile
├── docker-compose.yml
├── main.py
└── requirements.txt
requirements.txtでpipのパッケージ管理をしている 実行
code:sh
docker-compose up
code:Dockerfile
FROM python:3.8.2-alpine3.11
WORKDIR /src
RUN apk update --no-cache \
&& apk add --no-cache \
git
COPY requirements.txt .
RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
COPY . .
code:docker-compose.yml
---
version: '3'
services:
python:
build: .
tty: true
volumes:
- .:/src